#ifndef _RETRO_PLAYER_GRAPHIC_FPSCOUNTER
#define _RETRO_PLAYER_GRAPHIC_FPSCOUNTER

#include "player.graphic.h"

#define RETRO_FPS_SAMPLE_COUNT  10

namespace Retro
{
  namespace Player
  {
    namespace Graphic
    {
      typedef DOUBLE FPSREAL;

      class FPSCounter : public IGraphic
      {
      private:
        FPSREAL   mSamples[RETRO_FPS_SAMPLE_COUNT];
        FPSREAL   mSampleSum;
        UINT      mSampleIndex;
        LONGLONG  mLastTime;
        FPSREAL   mFPS;
        BOOL      mIgnored;
        BOOL      mInitialized;

      public:
        VOID        calcFPS();

        INL FPSREAL getFPS()
        {
          return mFPS;
        }

        FPSCounter();

        VOID init(Display::DisplayDevice* iDevice);
        VOID uninit(Display::DisplayDevice* iDevice);
      };
    }
  }
}

#endif
